<template>
  <Dialog :RHDialog="dialog" v-if="dialog.visible">
    <RHForm :RHForm="RHForm" :ref="formRef" :RHPre="RHPre"></RHForm>
  </Dialog>
</template>
<script>
import RHForm from "@/common/form/index";
import Dialog from "@/common/dialog/index";
import _ from "lodash";
export default {
  name: "dialogForm",
  components: { RHForm, Dialog },
  props: {
    RHDialog: {},
    RHForm: {
      type: Array
    },
    formRef: {
      type: String,
      default: "r_h_form"
    },
    RHPre: {
      type: Object
    }
  },
  data: function() {
    return {
      dialog: {
        visible: false,
        close: true,
        title: "",
        resetF: true,
        handleClose: this.resetForm,
        btn: []
      }
    };
  },
  created() {
    this.initialize();
  },
  methods: {
    resetForm() {
      if (this.resetF) {
        this.$refs.r_h_form.resetForm();
      }
    },
    initialize() {
      this.dialog = _.defaultsDeep(this.RHDialog, this.dialog);
    },
    getForm() {
      return this.$refs[this.formRef];
    }
  }
};
</script>

<style scoped></style>
